home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / toolkitcomps / nsICommandLine.h next >
C/C++ Source or Header  |  2006-05-08  |  14KB  |  344 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsICommandLine.idl
  3.  */
  4.  
  5. #ifndef __gen_nsICommandLine_h__
  6. #define __gen_nsICommandLine_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIFile; /* forward declaration */
  18.  
  19. class nsIURI; /* forward declaration */
  20.  
  21. class nsIDOMWindow; /* forward declaration */
  22.  
  23.  
  24. /* starting interface:    nsICommandLine */
  25. #define NS_ICOMMANDLINE_IID_STR "bc3173bd-aa46-46a0-9d25-d9867a9659b6"
  26.  
  27. #define NS_ICOMMANDLINE_IID \
  28.   {0xbc3173bd, 0xaa46, 0x46a0, \
  29.     { 0x9d, 0x25, 0xd9, 0x86, 0x7a, 0x96, 0x59, 0xb6 }}
  30.  
  31. /**
  32.  * Represents the command line used to invoke a XUL application. This may be the
  33.  * original command-line of this instance, or a command line remoted from another
  34.  * instance of the application.
  35.  *
  36.  * DEFINITIONS:
  37.  * "arguments" are any values found on the command line.
  38.  * "flags" are switches. In normalized form they are preceded by a single dash.
  39.  * Some flags may take "parameters", e.g. "-url <param>" or "-install-xpi <param>"
  40.  *
  41.  * @status UNDER_REVIEW This interface is intended to be frozen, but isn't frozen
  42.  *                      yet. Please use with care.
  43.  */
  44. class NS_NO_VTABLE nsICommandLine : public nsISupports {
  45.  public: 
  46.  
  47.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMMANDLINE_IID)
  48.  
  49.   /**
  50.    * Number of arguments in the command line. The application name is not
  51.    * part of the command line.
  52.    */
  53.   /* readonly attribute long length; */
  54.   NS_IMETHOD GetLength(PRInt32 *aLength) = 0;
  55.  
  56.   /**
  57.    * Get an argument from the array of command-line arguments.
  58.    *
  59.    * On windows, flags of the form /flag are normalized to -flag. /flag:param
  60.    * are normalized to -flag param.
  61.    *
  62.    * On *nix and mac flags of the form --flag are normalized to -flag. --flag=param
  63.    * are normalized to the form -flag param.
  64.    *
  65.    * @param aIndex The argument to retrieve. This index is 0-based, and does
  66.    *               not include the application name.
  67.    * @return       The indexth argument.
  68.    * @throws       NS_ERROR_INVALID_ARG if aIndex is out of bounds.
  69.    */
  70.   /* AString getArgument (in long aIndex); */
  71.   NS_IMETHOD GetArgument(PRInt32 aIndex, nsAString & _retval) = 0;
  72.  
  73.   /**
  74.    * Find a command-line flag.
  75.    *
  76.    * @param aFlag          The flag name to locate. Do not include the initial
  77.    *                       hyphen.
  78.    * @param aCaseSensitive Whether to do case-sensitive comparisons.
  79.    * @return               The position of the flag in the command line.
  80.    */
  81.   /* long findFlag (in AString aFlag, in boolean aCaseSensitive); */
  82.   NS_IMETHOD FindFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRInt32 *_retval) = 0;
  83.  
  84.   /**
  85.    * Remove arguments from the command line. This normally occurs after
  86.    * a handler has processed the arguments.
  87.    *
  88.    * @param aStart  Index to begin removing.
  89.    * @param aEnd    Index to end removing, inclusive.
  90.    */
  91.   /* void removeArguments (in long aStart, in long aEnd); */
  92.   NS_IMETHOD RemoveArguments(PRInt32 aStart, PRInt32 aEnd) = 0;
  93.  
  94.   /**
  95.    * A helper method which will find a flag and remove it in one step.
  96.    *
  97.    * @param aFlag  The flag name to find and remove.
  98.    * @param aCaseSensitive Whether to do case-sensitive comparisons.
  99.    * @return       Whether the flag was found.
  100.    */
  101.   /* boolean handleFlag (in AString aFlag, in boolean aCaseSensitive); */
  102.   NS_IMETHOD HandleFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRBool *_retval) = 0;
  103.  
  104.   /**
  105.    * Find a flag with a parameter and remove both. This is a helper
  106.    * method that combines "findFlag" and "removeArguments" in one step.
  107.    *
  108.    * @return   null (a void astring) if the flag is not found. The parameter value
  109.    *           if found. Note that null and the empty string are not the same.
  110.    * @throws   NS_ERROR_INVALID_ARG if the flag exists without a parameter
  111.    *
  112.    * @param aFlag The flag name to find and remove.
  113.    * @param aCaseSensitive Whether to do case-sensitive flag search.
  114.    */
  115.   /* AString handleFlagWithParam (in AString aFlag, in boolean aCaseSensitive); */
  116.   NS_IMETHOD HandleFlagWithParam(const nsAString & aFlag, PRBool aCaseSensitive, nsAString & _retval) = 0;
  117.  
  118.   /**
  119.    * The type of command line being processed.
  120.    *
  121.    * STATE_INITIAL_LAUNCH  is the first launch of the application instance.
  122.    * STATE_REMOTE_AUTO     is a remote command line automatically redirected to
  123.    *                       this instance.
  124.    * STATE_REMOTE_EXPLICIT is a remote command line explicitly redirected to
  125.    *                       this instance using xremote/windde/appleevents.
  126.    */
  127.   /* readonly attribute unsigned long state; */
  128.   NS_IMETHOD GetState(PRUint32 *aState) = 0;
  129.  
  130.   enum { STATE_INITIAL_LAUNCH = 0U };
  131.  
  132.   enum { STATE_REMOTE_AUTO = 1U };
  133.  
  134.   enum { STATE_REMOTE_EXPLICIT = 2U };
  135.  
  136.   /**
  137.    * There may be a command-line handler which performs a default action if
  138.    * there was no explicit action on the command line (open a default browser
  139.    * window, for example). This flag allows the default action to be prevented.
  140.    */
  141.   /* attribute boolean preventDefault; */
  142.   NS_IMETHOD GetPreventDefault(PRBool *aPreventDefault) = 0;
  143.   NS_IMETHOD SetPreventDefault(PRBool aPreventDefault) = 0;
  144.  
  145.   /**
  146.    * The working directory for this command line. Use this property instead
  147.    * of the working directory for the current process, since a redirected
  148.    * command line may have had a different working directory.
  149.    */
  150.   /* readonly attribute nsIFile workingDirectory; */
  151.   NS_IMETHOD GetWorkingDirectory(nsIFile * *aWorkingDirectory) = 0;
  152.  
  153.   /**
  154.    * A window to be targeted by this command line. In most cases, this will
  155.    * be null (xremote will sometimes set this attribute).
  156.    */
  157.   /* readonly attribute nsIDOMWindow windowContext; */
  158.   NS_IMETHOD GetWindowContext(nsIDOMWindow * *aWindowContext) = 0;
  159.  
  160.   /**
  161.    * Resolve a file-path argument into an nsIFile. This method gracefully
  162.    * handles relative or absolute file paths, according to the working
  163.    * directory of this command line.
  164.    *
  165.    * @param aArgument  The command-line argument to resolve.
  166.    */
  167.   /* nsIFile resolveFile (in AString aArgument); */
  168.   NS_IMETHOD ResolveFile(const nsAString & aArgument, nsIFile **_retval) = 0;
  169.  
  170.   /**
  171.    * Resolves a URI argument into a URI. This method has platform-specific
  172.    * logic for converting an absolute URI or a relative file-path into the
  173.    * appropriate URI object; it gracefully handles win32 C:\ paths which would
  174.    * confuse the ioservice if passed directly.
  175.    *
  176.    * @param aArgument  The command-line argument to resolve.
  177.    */
  178.   /* nsIURI resolveURI (in AString aArgument); */
  179.   NS_IMETHOD ResolveURI(const nsAString & aArgument, nsIURI **_retval) = 0;
  180.  
  181. };
  182.  
  183. /* Use this macro when declaring classes that implement this interface. */
  184. #define NS_DECL_NSICOMMANDLINE \
  185.   NS_IMETHOD GetLength(PRInt32 *aLength); \
  186.   NS_IMETHOD GetArgument(PRInt32 aIndex, nsAString & _retval); \
  187.   NS_IMETHOD FindFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRInt32 *_retval); \
  188.   NS_IMETHOD RemoveArguments(PRInt32 aStart, PRInt32 aEnd); \
  189.   NS_IMETHOD HandleFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRBool *_retval); \
  190.   NS_IMETHOD HandleFlagWithParam(const nsAString & aFlag, PRBool aCaseSensitive, nsAString & _retval); \
  191.   NS_IMETHOD GetState(PRUint32 *aState); \
  192.   NS_IMETHOD GetPreventDefault(PRBool *aPreventDefault); \
  193.   NS_IMETHOD SetPreventDefault(PRBool aPreventDefault); \
  194.   NS_IMETHOD GetWorkingDirectory(nsIFile * *aWorkingDirectory); \
  195.   NS_IMETHOD GetWindowContext(nsIDOMWindow * *aWindowContext); \
  196.   NS_IMETHOD ResolveFile(const nsAString & aArgument, nsIFile **_retval); \
  197.   NS_IMETHOD ResolveURI(const nsAString & aArgument, nsIURI **_retval); 
  198.  
  199. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  200. #define NS_FORWARD_NSICOMMANDLINE(_to) \
  201.   NS_IMETHOD GetLength(PRInt32 *aLength) { return _to GetLength(aLength); } \
  202.   NS_IMETHOD GetArgument(PRInt32 aIndex, nsAString & _retval) { return _to GetArgument(aIndex, _retval); } \
  203.   NS_IMETHOD FindFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRInt32 *_retval) { return _to FindFlag(aFlag, aCaseSensitive, _retval); } \
  204.   NS_IMETHOD RemoveArguments(PRInt32 aStart, PRInt32 aEnd) { return _to RemoveArguments(aStart, aEnd); } \
  205.   NS_IMETHOD HandleFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRBool *_retval) { return _to HandleFlag(aFlag, aCaseSensitive, _retval); } \
  206.   NS_IMETHOD HandleFlagWithParam(const nsAString & aFlag, PRBool aCaseSensitive, nsAString & _retval) { return _to HandleFlagWithParam(aFlag, aCaseSensitive, _retval); } \
  207.   NS_IMETHOD GetState(PRUint32 *aState) { return _to GetState(aState); } \
  208.   NS_IMETHOD GetPreventDefault(PRBool *aPreventDefault) { return _to GetPreventDefault(aPreventDefault); } \
  209.   NS_IMETHOD SetPreventDefault(PRBool aPreventDefault) { return _to SetPreventDefault(aPreventDefault); } \
  210.   NS_IMETHOD GetWorkingDirectory(nsIFile * *aWorkingDirectory) { return _to GetWorkingDirectory(aWorkingDirectory); } \
  211.   NS_IMETHOD GetWindowContext(nsIDOMWindow * *aWindowContext) { return _to GetWindowContext(aWindowContext); } \
  212.   NS_IMETHOD ResolveFile(const nsAString & aArgument, nsIFile **_retval) { return _to ResolveFile(aArgument, _retval); } \
  213.   NS_IMETHOD ResolveURI(const nsAString & aArgument, nsIURI **_retval) { return _to ResolveURI(aArgument, _retval); } 
  214.  
  215. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  216. #define NS_FORWARD_SAFE_NSICOMMANDLINE(_to) \
  217.   NS_IMETHOD GetLength(PRInt32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
  218.   NS_IMETHOD GetArgument(PRInt32 aIndex, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetArgument(aIndex, _retval); } \
  219.   NS_IMETHOD FindFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRInt32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->FindFlag(aFlag, aCaseSensitive, _retval); } \
  220.   NS_IMETHOD RemoveArguments(PRInt32 aStart, PRInt32 aEnd) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveArguments(aStart, aEnd); } \
  221.   NS_IMETHOD HandleFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->HandleFlag(aFlag, aCaseSensitive, _retval); } \
  222.   NS_IMETHOD HandleFlagWithParam(const nsAString & aFlag, PRBool aCaseSensitive, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->HandleFlagWithParam(aFlag, aCaseSensitive, _retval); } \
  223.   NS_IMETHOD GetState(PRUint32 *aState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetState(aState); } \
  224.   NS_IMETHOD GetPreventDefault(PRBool *aPreventDefault) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPreventDefault(aPreventDefault); } \
  225.   NS_IMETHOD SetPreventDefault(PRBool aPreventDefault) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPreventDefault(aPreventDefault); } \
  226.   NS_IMETHOD GetWorkingDirectory(nsIFile * *aWorkingDirectory) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWorkingDirectory(aWorkingDirectory); } \
  227.   NS_IMETHOD GetWindowContext(nsIDOMWindow * *aWindowContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWindowContext(aWindowContext); } \
  228.   NS_IMETHOD ResolveFile(const nsAString & aArgument, nsIFile **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResolveFile(aArgument, _retval); } \
  229.   NS_IMETHOD ResolveURI(const nsAString & aArgument, nsIURI **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResolveURI(aArgument, _retval); } 
  230.  
  231. #if 0
  232. /* Use the code below as a template for the implementation class for this interface. */
  233.  
  234. /* Header file */
  235. class nsCommandLine : public nsICommandLine
  236. {
  237. public:
  238.   NS_DECL_ISUPPORTS
  239.   NS_DECL_NSICOMMANDLINE
  240.  
  241.   nsCommandLine();
  242.  
  243. private:
  244.   ~nsCommandLine();
  245.  
  246. protected:
  247.   /* additional members */
  248. };
  249.  
  250. /* Implementation file */
  251. NS_IMPL_ISUPPORTS1(nsCommandLine, nsICommandLine)
  252.  
  253. nsCommandLine::nsCommandLine()
  254. {
  255.   /* member initializers and constructor code */
  256. }
  257.  
  258. nsCommandLine::~nsCommandLine()
  259. {
  260.   /* destructor code */
  261. }
  262.  
  263. /* readonly attribute long length; */
  264. NS_IMETHODIMP nsCommandLine::GetLength(PRInt32 *aLength)
  265. {
  266.     return NS_ERROR_NOT_IMPLEMENTED;
  267. }
  268.  
  269. /* AString getArgument (in long aIndex); */
  270. NS_IMETHODIMP nsCommandLine::GetArgument(PRInt32 aIndex, nsAString & _retval)
  271. {
  272.     return NS_ERROR_NOT_IMPLEMENTED;
  273. }
  274.  
  275. /* long findFlag (in AString aFlag, in boolean aCaseSensitive); */
  276. NS_IMETHODIMP nsCommandLine::FindFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRInt32 *_retval)
  277. {
  278.     return NS_ERROR_NOT_IMPLEMENTED;
  279. }
  280.  
  281. /* void removeArguments (in long aStart, in long aEnd); */
  282. NS_IMETHODIMP nsCommandLine::RemoveArguments(PRInt32 aStart, PRInt32 aEnd)
  283. {
  284.     return NS_ERROR_NOT_IMPLEMENTED;
  285. }
  286.  
  287. /* boolean handleFlag (in AString aFlag, in boolean aCaseSensitive); */
  288. NS_IMETHODIMP nsCommandLine::HandleFlag(const nsAString & aFlag, PRBool aCaseSensitive, PRBool *_retval)
  289. {
  290.     return NS_ERROR_NOT_IMPLEMENTED;
  291. }
  292.  
  293. /* AString handleFlagWithParam (in AString aFlag, in boolean aCaseSensitive); */
  294. NS_IMETHODIMP nsCommandLine::HandleFlagWithParam(const nsAString & aFlag, PRBool aCaseSensitive, nsAString & _retval)
  295. {
  296.     return NS_ERROR_NOT_IMPLEMENTED;
  297. }
  298.  
  299. /* readonly attribute unsigned long state; */
  300. NS_IMETHODIMP nsCommandLine::GetState(PRUint32 *aState)
  301. {
  302.     return NS_ERROR_NOT_IMPLEMENTED;
  303. }
  304.  
  305. /* attribute boolean preventDefault; */
  306. NS_IMETHODIMP nsCommandLine::GetPreventDefault(PRBool *aPreventDefault)
  307. {
  308.     return NS_ERROR_NOT_IMPLEMENTED;
  309. }
  310. NS_IMETHODIMP nsCommandLine::SetPreventDefault(PRBool aPreventDefault)
  311. {
  312.     return NS_ERROR_NOT_IMPLEMENTED;
  313. }
  314.  
  315. /* readonly attribute nsIFile workingDirectory; */
  316. NS_IMETHODIMP nsCommandLine::GetWorkingDirectory(nsIFile * *aWorkingDirectory)
  317. {
  318.     return NS_ERROR_NOT_IMPLEMENTED;
  319. }
  320.  
  321. /* readonly attribute nsIDOMWindow windowContext; */
  322. NS_IMETHODIMP nsCommandLine::GetWindowContext(nsIDOMWindow * *aWindowContext)
  323. {
  324.     return NS_ERROR_NOT_IMPLEMENTED;
  325. }
  326.  
  327. /* nsIFile resolveFile (in AString aArgument); */
  328. NS_IMETHODIMP nsCommandLine::ResolveFile(const nsAString & aArgument, nsIFile **_retval)
  329. {
  330.     return NS_ERROR_NOT_IMPLEMENTED;
  331. }
  332.  
  333. /* nsIURI resolveURI (in AString aArgument); */
  334. NS_IMETHODIMP nsCommandLine::ResolveURI(const nsAString & aArgument, nsIURI **_retval)
  335. {
  336.     return NS_ERROR_NOT_IMPLEMENTED;
  337. }
  338.  
  339. /* End of implementation class template. */
  340. #endif
  341.  
  342.  
  343. #endif /* __gen_nsICommandLine_h__ */
  344.